<template>
	<view class="setting-container">
		<!-- navbar -->
		<!-- <view class="header">
			<image src="/static/images/leftarrow.png" @click="goBack" />
			<view class="title">设置</view>
		</view> -->
		
		<!-- 设置 -->
		<view class="setting">
			<view class="setting-item password">
				<view class="text">修改密码</view>
				<image src="/static/images/arrowright.png" />
			</view>
			<view class="setting-item submit">
				<view class="text">提交反馈</view>
				<image src="/static/images/arrowright.png" />
			</view>
			<view class="setting-item versions">
				<view class="text">版本</view>
				<view>v1.0.0</view>
			</view>
		</view>
	
	    <!-- 退出登录 -->
		<view class="logout" @click="logOut">退出登录</view>
	</view>
</template>

<script setup>
	import { useLoginStore, useCartStore } from '../../stores/store.js'
	
	const loginStore = useLoginStore()
	const cartStore = useCartStore()
	
	// 退出登录
	const logOut = () => {
		uni.showModal({
		  title: '确定退出吗',
		  success: function (res) {
		    if (res.confirm) {
		      loginStore.logOut()
			  cartStore.selectSiteData = {}
			  cartStore.cartData = []
			  cartStore.cartDataId = ''
		    }
		  }
		});
	}
	
	
	// 返回
	const goBack = () => {
		uni.navigateBack()
	}
</script>

<style lang="scss" scoped>
	.setting-container {
		width: px2rpx(375);
		
		// navbar
		.header {
			width: px2rpx(375);
			height: px2rpx(50);
			display: flex;
			align-items: center;
			border-bottom: 1px solid #ccc;
		
			image {
				width: px2rpx(16);
				height: px2rpx(16);
				margin: 0 px2rpx(20);
			}
		
			.title {
				font-size: px2rpx(14);
				margin-left: px2rpx(120);
			}
		}
	
	    // 设置
		.setting {
			width: px2rpx(355);
			.password, .submit {
				border-bottom: 1px solid #ccc;
			}
			
			.setting-item {
				width: px2rpx(355);
				height: px2rpx(44);
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin: 0 px2rpx(10);
				
				image {
					width: px2rpx(20);
					height: px2rpx(20);
				}
			}
			
			
		}
	
	    // 退出登录
		.logout {
			position: fixed;
			width: px2rpx(375);
			height: px2rpx(44);
			background-color: #ee0a24;
			font-size: px2rpx(14);
			color: #fff;
			bottom: 0;
			display: flex;
			justify-content: center;
			align-items: center;
		}
	}       
</style>
